The present disclosure relates generally to a computer system, and more specifically, to data replication in a database management system.
Various types of database management systems (DBMS) exist which are usually optimized for performing some particular kinds of database queries efficiently. Said special-purpose DBMS may be able to efficiently process database queries of a first type but may be slow when processing database queries of another type because the table structure and indices of the database managed by the DBMS are not optimized for said other kind of queries. For example, an OLAP database may process OLAP queries efficiently, but not OLTP queries. An OLTP database may process OLTP queries efficiently, but not OLAP queries.
Some existing approaches (based e.g. on hybrid DBMSs) try to overcome said difficulties by storing the data redundantly in two different copies of the data to be queried. Each copy is stored in a database that may be optimized for efficiently performing a particular kind of database query.
In addition to said OLTP/OLAP scenario, other use cases exist where data is stored redundantly in multiple databases having the same or a different structure, e.g. in the context of cloud environments.
A problem associated with storing multiple copies of the same data in multiple databases is that data changes applied in one of said copies need to be replicated to the other copy. Before said replication is successfully performed, said two copies are out of sync and may return different results in response to a database query. Data-synchronization protocols such as the “two-phase commit protocol” (2PC) coordinate all the processes that participate in a decision on whether and when to replicate a transaction that has already been performed in one of said two copies to the other copy. The replication shall ensure data consistency of the two copies. However, said 2PC protocols are “heavy-weight” because synchronous round-trips for keeping the two data copies in sync generate a significant computational overhead.